﻿@model IEnumerable<GolfController.Models.Course>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>



@using (Ajax.BeginForm("Search", "Course", new AjaxOptions
{
    HttpMethod = "GET",
    InsertionMode = InsertionMode.Replace,
    UpdateTargetId = "searchResults",
    LoadingElementId="progress"
}))
{
    
    <input type ="text" name="q"  data-autocomplete="@Url.Action("QuickSearch" , "Course")"/>
    <input type ="submit" value ="Search" />
    
}

<div id="progress">
<img src ="../../Content/img/ajax-loader1.gif" />
</div>
<table id ="searchResults">

</table>
                
                
                
<table>
    <tr>
        <th>
            Name
        </th>
        <th>
            Holes
        </th>
        <th>
         Par
        </th>
        <th>
        Total Length
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.NumberOfHoles)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.TotalPar)
        </td>
           <td>
            @Html.DisplayFor(modelItem => item.TotalLength)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
            @Html.ActionLink("Details", "Details", new { id=item.ID }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.ID })  |
            @Html.ActionLink("View Holes", "ViewHoles" , "Hole", new { id=item.ID } , null ) 

        </td>
    </tr>
}

</table>
